<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>作业7</title>
    <script>
        /*
        7. 编写函数rev(char) 实现将字符串char倒置
        比如rev("spring") 返回"gnirps"
        */

        function rev(char) {
            return char.split("").reverse().join("");
        }

        var char = prompt("输入一个字符串:");
        console.log("该字符串翻转之后："+rev(char));

    </script>
</head>
<body>
    
</body>
</html>